import { Component } from '@angular/core';
import { NavController,ViewController,NavParams} from 'ionic-angular';
import { ImagePicker } from '@ionic-native/image-picker';
@Component({
  selector: 'page-register',
  templateUrl: 'register.html'
})
export class RegisterPage {
	userId:any;
	constructor(private imagePicker :ImagePicker,private navCtrl:NavController,private viewCtrl:ViewController,private navParams:NavParams){
		this.userId = navParams.get("userId");
		console.log(this.userId);
	}
	ionViewDidEnter(){
		console.log(this.userId+"222222");
	}
	close(){
		console.log('UserId', this.navParams.get('userId'));
		//传参数回上个页面
		 let data = { 'foo': 'bar' };
		this.viewCtrl.dismiss(data);
	}
	imagePick(){
		let options = {
    		// max images to be selected, defaults to 15. If this is set to 1, upon
			// selection of a single image, the plugin will return it.
			//maximumImagesCount: int,
			// max width and height to allow the images to be.  Will keep aspect
			// ratio no matter what.  So if both are 800, the returned image
			// will be at most 800 pixels wide and 800 pixels tall.  If the width is
			// 800 and height 0 the image will be 800 pixels wide if the source
			// is at least that wide.
			width: 400,
			height: 200,
	
			// quality of resized image, defaults to 100
			//quality: int (0-100)
			quality: 1
		};
		this.imagePicker.getPictures(options).then((results) => {
  		for (var i = 0; i < results.length; i++) {
      		console.log('Image URI: ' + results[i]);
  		}
		}, (err) => { });
	}
}